 let arr = [9,1, 2, 1, 2, 3, 5, 4, 5, 3, 4, 4, 4, 4,'',undefined,null,''];

// const filterNonUnique = arr.filter(i => arr.indexOf(i) === arr.lastIndexOf(i))
// console.log(filterNonUnique)
let arr2 = [9,1, 2, 1, 2, 3, 5, 4, 5, 3, 4, 4, 4, 4];
function ask(arr){
    var obj ={},newArr =[]
   
    for(let i = 0;i<arr.length;i++){
       
        if(!obj[arr[i]]){
            obj[arr[i]]={
                val:arr[i],
                remove:false
            }
        }else{
            obj[arr[i]]={
                val:arr[i],
                remove:true
            }
        }
    }

   
    for(let j in obj){
        if(!obj[j].remove){
            newArr.push(obj[j].val)
        }
    }
    console.log(obj,newArr)
}
ask(arr2)

// const filterNonUnique = arr => arr.filter(i => arr.indexOf(i) === arr.lastIndexOf(i))
// console.log(filterNonUnique(arr))
